using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JVIT.TimeSheet.BLL
{
    public static class TimeSpanExtension
    {
        public const string TIME_NOTATION = "HH:mm:ss";
        public static string ToReadableString(this TimeSpan span)
        {
            string format = "";
            if (span.Hours > 0) format = "{0:0} hours + {1:0} minutes + {2:0} seconds";
            else if (span.Minutes > 0) format = "{1:0} minutes + {2:0} seconds";
            else format = "{2:0} seconds";
            return string.Format(format, span.Hours, span.Minutes, span.Seconds);
        }
    }
}
